package com.cenntro.oss.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cenntro.common.base.BaseController;
import com.cenntro.common.util.result.PageResult;
import com.cenntro.common.util.result.Result;
import com.cenntro.oss.model.qo.RunListQO;
import com.cenntro.oss.model.vo.RunListVO;
import com.cenntro.oss.service.DevRunService;

/**
 * 
* @ClassName: DevRunController
* @Description: 车辆行驶记录表，一次启动一次熄火里程大于0.1公司算一个行程； 前端控制器
* @author 15815
* @date 2019年7月3日
*
 */

@RestController
@RequestMapping("/run")
public class DevRunController extends BaseController {

    @Resource
    private DevRunService devRunService;

    /**
     * 
    * @Title list
    * @Description 车辆行驶记录
    * @param qo
    * @return  
    * @throws
     */
    @CrossOrigin
    @RequestMapping(value = "/list")
    public Result list(RunListQO qo) {
        if (qo.getAgentId() <= 0 || qo.getAgentId() == null) {
            return Result.error("参数错误");
        }
        List<RunListVO> list = devRunService.selectList(qo);
        int count = devRunService.selectListCount(qo);
        return PageResult.ok(list, count);
    }
}
